import React from 'react';
import groupStyle from './Filter.less';
import cx from 'classnames';

export default class Group extends React.Component {

	// 限制属性的数据类型
	static propTypes = {
		wrap: React.PropTypes.bool,
		name: React.PropTypes.string
	};

	// 设定属性默认值
	static defaultProps = {
		wrap: false
	};

	constructor(props) {
		super(props);
	}

	render() {
		let { name, children, wrap } = this.props;
		let allowWrap = wrap ? groupStyle.wrap : '';
		let className = cx(groupStyle.row, allowWrap);

		return (
			<div className={className}>
				<label>{name}</label>
				{children}
			</div>
		);
	}
}